//
// object.h
//
//  Created on: Aug 2, 2013
//      Author: Manish Kumar
//

#ifndef OBJECT_H_
#define OBJECT_H_

#include <mutex>
#include <exception>
#include <iterator>

namespace mkTest {

// TODO:
// 1. define a object
// 2. its allocator
// 3. an iterator for it
// XXX: traits
// http://www.generic-programming.org/languages/cpp/techniques.php
// http://gee.cs.oswego.edu/dl/oosdw3/ch25.html
// http://www.cantrip.org/cpp.html
// http://accu.org/index.php/journals/442
//
// XXX: efficiency
// http://en.wikibooks.org/wiki/Optimizing_C%2B%2B
//

// for iterator, define its iterator_traits (5 values like ::iterator_category, ::iterator::value_type, difference_type, pointer, referece)

// struct _Object_iterator : public std::iterator<std::bidirectional_iterator_tag, __Object> {};

template<typename _Tp>
struct _Object_iterator {
    typedef std::bidirectional_iterator_tag iterator_category;
    typedef _Tp         value_type;
    typedef std::ptrdiff_t   difference_type;
    typedef _Tp*        pointer;
    typedef _Tp&        reference;
};

template<typename _Tp>
struct __Object_const_iterator {
    typedef std::bidirectional_iterator_tag iterator_category;
    typedef _Tp         value_type;
    typedef std::ptrdiff_t   difference_type;
    typedef const _Tp*  pointer;
    typedef const _Tp&  reference;
};



template<typename _Tp, typename _Alloc = std::allocator<_Tp>>
class __Object {
    public:

    // compiler default generation
//    Object() = default;
//    Object(Object&) = default;
//
//    // default movable
//    Object(Object&&) = default;
//
//
//    virtual ~Object();

    private:
    mutable std::mutex mutex_;
};

}


#endif /* OBJECT_H_ */
